home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Freeware 2002 November
/
SGI Freeware 2002 November - Disc 2.iso
/
dist
/
fw_groff.idb
/
usr
/
freeware
/
info
/
groff-3.z
/
groff-3
Wrap
Text File
|
2002-04-08
|
51KB
|
1,447 lines
This is groff, produced by makeinfo version 4.0 from groff.texinfo.
INFO-DIR-SECTION Miscellaneous
START-INFO-DIR-ENTRY
* Groff: (groff). The GNU troff document formatting system.
END-INFO-DIR-ENTRY
This Info file documents GNU troff version 1.16.
Published by the Free Software Foundation 59 Temple Place, Suite 330
Boston, MA 02111-1307 USA
Copyright (C) 1994-2000 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that this permission notice may be stated in a
translation approved by the Foundation.
Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided also
that the section entitled "GNU General Public License" is included
exactly as in the original, and provided that the entire resulting
derived work is distributed under the terms of a permission notice
identical to this one.
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that the section entitled "GNU General Public License"
may be included in a translation approved by the Free Software
Foundation instead of in the original English.
File: groff, Node: Setting Registers, Next: Interpolating Registers, Prev: Registers, Up: Registers
Setting Registers
-----------------
Define or set registers using the `nr' request or the `\R' escape.
- Request: .nr ident value
- Escape: \R'IDENT VALUE'
Set number register IDENT to VALUE. If IDENT doesn't exist,
`gtroff' creates it.
The argument to `\R' usually has to be enclosed in quotes. *Note
Escapes::, for details on parameter delimiting characters.
For example, the following two lines are equivalent:
.nr a 1
\R'a 1'
Both `nr' and `\R' have two additional special forms to increment or
decrement a register.
- Request: .nr ident +value
- Request: .nr ident -value
- Escape: \R'IDENT +VALUE'
- Escape: \R'IDENT -VALUE'
Increment (decrement) register IDENT by VALUE.
.nr a 1
.nr a +1
\na
=> 2
To assign the negated value of a register to another register,
some care must be taken to get the desired result:
.nr a 7
.nr b 3
.nr a -\nb
\na
=> 4
.nr a (-\nb)
\na
=> -3
The surrounding parentheses prevent the interpretation of the
minus sign as a decrementing operator. An alternative is to start
the assignment with a `0':
.nr a 7
.nr b -3
.nr a \nb
\na
=> 4
.nr a 0\nb
\na
=> -3
- Request: .rr ident
Remove number register IDENT. If IDENT doesn't exist, the request
is ignored.
- Request: .rnn ident1 ident2
Rename number register IDENT1 to IDENT2. If either IDENT1 or
IDENT2 doesn't exist, the request is ignored.
- Request: .aln ident1 ident2
Create an alias IDENT1 for a number register IDENT2. The new name
and the old name are exactly equivalent. If IDENT1 is undefined,
a warning of type `reg' is generated, and the request is ignored.
*Note Debugging::, for information about warnings.
File: groff, Node: Interpolating Registers, Next: Auto-increment, Prev: Setting Registers, Up: Registers
Interpolating Registers
-----------------------
Numeric registers can be accessed via the `\n' escape.
- Escape: \nI
- Escape: \n(ID
- Escape: \n[IDENT]
Interpolate number register with name IDENT (one-character name I,
two-character name ID). This means that the value of the register
is expanded in-place while `gtroff' is parsing the input line.
Nested assignments (also called indirect assignments) are possible.
.nr a 5
.nr as \na+\na
\n(as
=> 10
.nr a1 5
.nr ab 6
.ds str b
.ds num 1
\n[a\n[num]]
=> 5
\n[a\*[str]]
=> 6
File: groff, Node: Auto-increment, Next: Assigning Formats, Prev: Interpolating Registers, Up: Registers
Auto-increment
--------------
Number registers can also be auto-incremented and auto-decremented.
The increment or decrement value can be specified with a third argument
to the `nr' request or `\R' escape.
- Request: .nr ident value incr
Set number register IDENT to VALUE; the increment for
auto-incrementing is set to INCR. Note that the `\R' escape
doesn't support this notation.
To activate auto-incrementing, the escape `\n' has a special syntax
form.
- Escape: \n+I
- Escape: \n-I
- Escape: \n(+ID
- Escape: \n(-ID
- Escape: \n+(ID
- Escape: \n-(ID
- Escape: \n[+IDENT]
- Escape: \n[-IDENT]
- Escape: \n+[IDENT]
- Escape: \n-[IDENT]
Before interpolating, increment or decrement IDENT (one-character
name I, two-character name ID) by the auto-increment value as
specified with the `nr' request (or the `\R' escape). If no
auto-increment value has been specified, these syntax forms are
identical to `\n'.
For example,
.nr a 0 1
.nr xx 0 5
.nr foo 0 -2
\n+a, \n+a, \n+a, \n+a, \n+a
.br
\n-(xx, \n-(xx, \n-(xx, \n-(xx, \n-(xx
.br
\n+[foo], \n+[foo], \n+[foo], \n+[foo], \n+[foo]
produces
1, 2, 3, 4, 5
-5, -10, -15, -20, -25
-2, -4, -6, -8, -10
To change the increment value without changing the value of a
register (A in the example), the following can be used:
.nr a \na 10
File: groff, Node: Assigning Formats, Next: Built-in Registers, Prev: Auto-increment, Up: Registers
Assigning Formats
-----------------
When a register is used in the text of an input file (as opposed to
part of an expression), it is textually replaced (or interpolated) with
a representation of that number. This output format can be changed to
a variety of formats (numbers, Roman numerals, etc.). This is done
using the `af' request.
- Request: .af ident format
Change the output format of a number register. The first argument
IDENT is the name of the number register to be changed, and the
second argument FORMAT is the output format. The following output
formats are available:
`1'
Decimal arabic numbers. This is the default format: 0, 1, 2,
3, ....
`0...0'
Decimal numbers with as many digits as specified. So, `00'
would result in printing numbers as 01, 02, 03, ....
In fact, any digit instead of zero will do; `gtroff' only
counts how many digits are specified. As a consequence,
`af''s default format `1' could be specified as `0' also (and
exactly this is returned by the `\g' escape, see below).
`I'
Upper-case Roman numerals: 0, I, II, III, IV, ....
`i'
Lower-case Roman numerals: 0, i, ii, iii, iv, ....
`A'
Upper-case letters: 0, A, B, C, ..., Z, AA, AB, ....
`a'
Lower-case letters: 0, a, b, c, ..., z, aa, ab, ....
Omitting the number register format causes a warning of type
`missing'. *Note Debugging::, for more details. Specifying a
nonexistent format causes an error.
The following example produces `10, X, j, 010':
.nr a 10
.af a 1 \" the default format
\na,
.af a I
\na,
.af a a
\na,
.af a 001
\na
The largest number representable for the `i' and `I' formats is
39999 (or -39999); UNIX `troff' uses `z' and `w' to represent
10000 and 5000 in Roman numerals, and so does `gtroff'.
Currently, the correct glyphs of Roman numeral five thousand and
Roman numeral ten thousand (Unicode code points `U+2182' and
`U+2181', respectively) are not available.
If IDENT doesn't exist, it is created.
Changing the output format of a read-only register causes an
error. It is necessary to first copy the register's value to a
writeable register, then apply the `af' request to this other
register.
- Escape: \gI
- Escape: \g(ID
- Escape: \g[IDENT]
Return the current format of the specified register IDENT
(one-character name I, two-character name ID). For example, `\ga'
after the previous example would produce the string `000'. If the
register hasn't been defined yet, nothing is returned.
File: groff, Node: Built-in Registers, Prev: Assigning Formats, Up: Registers
Built-in Registers
------------------
The following lists some built-in registers which are not described
elsewhere in this manual. Any register which begins with a `.' is
read-only. A complete listing of all built-in registers can be found in
*Note Register Index::.
`.H'
Horizontal resolution in basic units.
`.V'
Vertical resolution in basic units.
`dw'
Day of the week (1-7).
`dy'
Day of the month (1-31).
`mo'
Current month (1-12).
`year'
The current year.
`yr'
The current year minus 1900. Unfortunately, the documentation of
UNIX Version 7's `troff' had a year 2000 bug: It incorrectly
claimed that `yr' contains the last two digits of the year. That
claim has never been true of either traditional `troff' or GNU
`troff'. Old `troff' input that looks like this:
'\" The following line stopped working after 1999
This document was formatted in 19\n(yr.
can be corrected as follows:
This document was formatted in \n[year].
or, to be portable to older `troff' versions, as follows:
.nr y4 1900+\n(yr
This document was formatted in \n(y4.
`.c'
`c.'
The current _input_ line number. Register `.c' is read-only,
whereas `c.' (a `gtroff' extension) is writable also, affecting
both `.c' and `c.'.
`ln'
The current _output_ line number after a call to the `nm' request
to activate line numbering.
*Note Miscellaneous::, for more information about line numbering.
`.x'
The major version number. For example, if the version number
is 1.03 then `.x' contains `1'.
`.y'
The minor version number. For example, if the version number
is 1.03 then `.y' contains `03'.
`.Y'
The revision number of `groff'.
`.g'
Always 1. Macros should use this to determine whether they are
running under GNU `troff'.
`.A'
If the command line option `-a' is used to produce an ASCII
approximation of the output, this is set to 1, zero otherwise.
*Note Groff Options::.
`.P'
This register is set to 1 (and to 0 otherwise) if the current page
is actually being printed, i.e., if the `-o' option is being used
to only print selected pages. *Note Groff Options::, for more
information.
`.T'
If `gtroff' is called with the `-T' command line option, the
number register `.T' is set to 1, and zero otherwise. *Note Groff
Options::.
Additionally, `gtroff' predefines a single read-write string
register `.T' which contains the current output device (for
example, `latin1' or `ps').
File: groff, Node: Manipulating Filling and Adjusting, Next: Manipulating Hyphenation, Prev: Registers, Up: gtroff Reference
Manipulating Filling and Adjusting
==================================
Various ways of causing "breaks" were given in *Note Implicit Line
Breaks::. The `br' request likewise causes a break. Several other
requests also cause breaks, but implicitly. These are `bp', `ce',
`cf', `fi', `fl', `in', `nf', `rj', `sp', `ti', and `trf'.
- Request: .br
Break the current line, i.e., the input collected so far is emitted
without adjustment.
If the no-break control character is used, `gtroff' suppresses the
break:
a
'br
b
=> a b
Initially, `gtroff' fills and adjusts text to both margins. Filling
can be disabled via the `nf' request and re-enabled with the `fi'
request.
- Request: .fi
- Register: \n[.u]
Activate fill mode (which is the default). This request implicitly
enables adjusting; it also inserts a break in the text currently
being filled. The read-only number register `.u' is set to 1.
The fill mode status is associated with the current environment
(*note Environments::).
- Request: .nf
Activate no-fill mode. Input lines are output as-is, retaining
line breaks and ignoring the current line length. This command
implicitly disables adjusting; it also causes a break. The number
register `.u' is set to 0.
The fill mode status is associated with the current environment
(*note Environments::).
- Request: .ad [mode]
- Register: \n[.j]
Set adjusting mode.
Activation and deactivation of adjusting is done implicitly with
calls to the `fi' or `nf' requests.
MODE can have one of the following values:
`l'
Adjust text to the left margin. This produces what is
traditionally called ragged-right text.
`r'
Adjust text to the right margin, producing ragged-left text.
`c'
Center filled text. This is different to the `ce' request
which only centers text without filling.
`b'
`n'
Justify to both margins. This is the default used by
`gtroff'.
With no argument, `gtroff' adjusts lines in the same way it did
before adjusting was deactivated (with a call to `na', for
example).
text
.ad r
text
.ad c
text
.na
text
.ad \" back to centering
text
The current adjustment mode is available in the read-only number
register `.j'; it can be stored and subsequently used to set
adjustment.
The adjustment mode status is associated with the current
environment (*note Environments::).
- Request: .na
Disable adjusting. This request won't change the current
adjustment mode: A subsequent call to `ad' uses the previous
adjustment setting.
The adjustment mode status is associated with the current
environment (*note Environments::).
- Escape: \p
Adjust the current line and cause a break.
In most cases this produces very ugly results, since `gtroff'
doesn't have a sophisticated paragraph building algorithm (as TeX
have, for example); instead, `gtroff' fills and adjusts a paragraph
line by line:
This is an uninteresting sentence.
This is an uninteresting sentence.\p
This is an uninteresting sentence.
is formatted as
This is an uninteresting sentence. This is an
uninteresting sentence.
This is an uninteresting sentence.
- Request: .ss word_space_size [sentence_space_size]
- Register: \n[.ss]
- Register: \n[.sss]
Change the minimum size of a space between filled words. It takes
its units as one twelfth of the space width parameter for the
current font. Initially both the WORD_SPACE_SIZE and
SENTENCE_SPACE_SIZE are 12.
If two arguments are given to the `ss' request, the second
argument sets the sentence space size. If the second argument is
not given, sentence space size is set to WORD_SPACE_SIZE. The
sentence space size is used in two circumstances: If the end of a
sentence occurs at the end of a line in fill mode, then both an
inter-word space and a sentence space are added; if two spaces
follow the end of a sentence in the middle of a line, then the
second space is a sentence space. If a second argument is never
given to the `ss' request, the behaviour of UNIX `troff' is the
same as that exhibited by GNU `troff'. In GNU `troff', as in UNIX
`troff', a sentence should always be followed by either a newline
or two spaces.
The read-only number registers `.ss' and `.sss' hold the values of
the parameters set by the first and second arguments of the `ss'
request.
The word space and sentence space values are associated with the
current environment (*note Environments::).
Contrary to traditional Unix `troff', this request is _not_
ignored if a tty output device is used; the given values are then
rounded down to a multiple of 12.
The request is ignored if there is no parameter.
- Request: .ce [nnn]
- Register: \n[.ce]
Center text. While the `.ad c' request also centers text, it
fills the text as well. `ce' does not fill the text it affects.
This request causes a break.
The following example demonstrates the differences. Here the
input:
.ll 4i
.ce 1000
This is a small text fragment which shows the differences
between the `.ce' and the `.ad c' request.
.ce 0
.ad c
This is a small text fragment which shows the differences
between the `.ce' and the `.ad c' request.
And here the result:
This is a small text fragment which
shows the differences
between the `.ce' and the `.ad c' request.
This is a small text fragment which
shows the differences between the `.ce'
and the `.ad c' request.
With no arguments, `ce' centers the next line of text. NNN
specifies the number of lines to be centered. If the argument is
zero or negative, centering is disabled.
The basic length for centering text is the line length (as set
with the `ll' request) minus the indentation (as set with the `in'
request). Temporary indentation is ignored.
As can be seen in the previous example, it is a common idiom to
turn on centering for a large number of lines, and to turn off
centering after text to be centered. This is useful for any
request which takes a number of lines as an argument.
The `.ce' read-only number register contains the number of lines
remaining to be centered, as set by the `ce' request.
- Request: .rj [nnn]
- Register: \n[.rj]
Justify unfilled text to the right margin. Arguments are
identical to the `ce' request. The `.rj' read-only number
register is the number of lines to be right-justified as set by
the `rj' request. This request causes a break.
File: groff, Node: Manipulating Hyphenation, Next: Manipulating Spacing, Prev: Manipulating Filling and Adjusting, Up: gtroff Reference
Manipulating Hyphenation
========================
As discussed in *Note Hyphenation::, `gtroff' hyphenates words.
There are a number of ways to influence hyphenation.
- Request: .hy [mode]
- Register: \n[.hy]
Enable hyphenation. The request has an optional numeric argument,
MODE, to restrict hyphenation if necessary:
`1'
The default argument if MODE is omitted. Hyphenate without
restrictions. This is also the start-up value of `gtroff'.
`2'
Do not hyphenate the last word on a page or column.
`4'
Do not hyphenate the last two characters of a word.
`8'
Do not hyphenate the first two characters of a word.
Values in the previous table are additive. For example, the
value 12 causes `gtroff' to neither hyphenate the last two nor the
first two characters of a word.
The current hyphenation restrictions can be found in the read-only
number register `.hy'.
The hyphenation mode is associated with the current environment
(*note Environments::).
- Request: .nh
Disable hyphenation (i.e., set the hyphenation mode to zero). Note
that the hyphenation mode of the last call to `hy' is not
remembered.
The hyphenation mode is associated with the current environment
(*note Environments::).
- Request: .hlm [nnn]
- Register: \n[.hlm]
- Register: \n[.hlc]
Set the maximum number of consecutive hyphenated lines to NNN. If
this number is negative, there is no maximum. The default value
is -1 if NNN is omitted. This value is associated with the
current environment (*note Environments::). Only lines output
from a given environment count towards the maximum associated with
that environment. Hyphens resulting from `\%' are counted;
explicit hyphens are not.
The current setting of `hlm' is available in the `.hlm' read-only
number register. Also the number of immediately preceding
consecutive hyphenated lines are available in the read-only number
register `.hlc'.
- Request: .hw word1 word2 ...
Define how WORD1, WORD2, etc. are to be hyphenated. The words
must be given with hyphens at the hyphenation points. For example:
.hw in-sa-lub-rious
Besides the space character, any character whose hyphenation code
value is zero can be used to separate the arguments of `hw' (see
the documentation for the `hcode' request below for more
information). In addition, this request can be used more than
once.
Hyphenation exceptions specified with the `hw' request are
associated with the current hyphenation language; it causes an
error if there is no current hyphenation language.
This request is ignored if there is no parameter.
In old versions of `troff' there was a limited amount of space to
store such information; fortunately, with `gtroff', this is no
longer a restriction.
- Escape: \%
To tell `gtroff' how to hyphenate words on the fly, use the `\%'
escape, also known as the "hyphenation character". Preceding a
word with this character prevents it from being hyphenated;
putting it inside a word indicates to `gtroff' that the word may
be hyphenated at that point. Note that this mechanism only
affects that one occurrence of the word; to change the hyphenation
of a word for the entire document, use the `hw' request.
- Request: .hc [char]
Change the hyphenation character to CHAR. This character then
works the same as the `\%' escape, and thus, no longer appears in
the output. Without an argument, `hc' resets the hyphenation
character to be `\%' (the default) only.
The hyphenation character is associated with the current
environment (*note Environments::).
- Request: .hpf pattern_file
Read in a file of hyphenation patterns. This file is searched for
in the same way as `NAME.tmac' (or `tmac.NAME') is searched for if
the `-mNAME' option is specified.
It should have the same format as the argument to the `\patterns'
primitive in TeX (without using TeX's macro expansion); the
letters appearing in this file are interpreted as hyphenation
codes. A `%' character in the patterns file introduces a comment
that continues to the end of the line.
If no `hpf' request is specified (either in the document or in a
macro package), `gtroff' won't hyphenate at all.
The set of hyphenation patterns is associated with the current
language set by the `hla' request. The `hpf' request is usually
invoked by the `troffrc' or `troffrc-end' file; by default,
`troffrc' loads hyphenation patterns for American English (in file
`hyphen.us').
Invoking `hpf' causes an error if there is no current hyphenation
language.
- Request: .hcode c1 code1 c2 code2 ...
Set the hyphenation code of character C1 to CODE1, that of C2 to
CODE2, etc. A hyphenation code must be a single input character
(not a special character) other than a digit or a space.
Initially each lower-case letter (`a'-`z') has its hyphenation set
to itself, and each upper-case letter (`A'-`Z') has a hyphenation
code which is the lower-case version of itself.
This request is ignored if it has no parameter.
- Request: .hym [length]
- Register: \n[.hym]
Set the (right) hyphenation margin to LENGTH. If the current
adjustment mode is not `b' or `n', the line is not hyphenated if
it is shorter than LENGTH. Without an argument, the hyphenation
margin is reset to its default value, which is 0. The default
scaling indicator for this request is `m'. The hyphenation margin
is associated with the current environment (*note Environments::).
A negative argument resets the hyphenation margin to zero, emitting
a warning of type `range'.
The current hyphenation margin is available in the `.hym' read-only
number register.
- Request: .hys [hyphenation_space]
- Register: \n[.hys]
Set the hyphenation space to HYPHENATION_SPACE. If the current
adjustment mode is `b' or `n', don't hyphenate the line if it can
be justified by adding no more than HYPHENATION_SPACE extra space
to each word space. Without argument, the hyphenation space is
set to its default value, which is 0. The default scaling
indicator for this request is `m'. The hyphenation space is
associated with the current environment (*note Environments::).
A negative argument resets the hyphenation space to zero, emitting
a warning of type `range'.
The current hyphenation space is available in the `.hys' read-only
number register.
- Request: .shc [char]
Set the soft hyphen character to CHAR. If the argument is
omitted, the soft hyphen character is set to the default character
`\(hy' (this is the start-up value of `gtroff' also). The soft
hyphen character is the character that is inserted when a word is
hyphenated at a line break. If the soft hyphen character does not
exist in the font of the character immediately preceding a
potential break point, then the line is not broken at that point.
Neither definitions (specified with the `char' request) nor
translations (specified with the `tr' request) are considered when
finding the soft hyphen character.
- Request: .hla language
- Register: \n[.hla]
Set the current hyphenation language to the string LANGUAGE.
Hyphenation exceptions specified with the `hw' request and
hyphenation patterns specified with the `hpf' request are both
associated with the current hyphenation language. The `hla'
request is usually invoked by the `troffrc' or the `troffrc-end'
files; `troffrc' sets the default language to `us'.
The current hyphenation language is available as a string in the
read-only number register `.hla'.
.ds curr_language \n[.hla]
\*[curr_language]
=> us
File: groff, Node: Manipulating Spacing, Next: Tabs and Fields, Prev: Manipulating Hyphenation, Up: gtroff Reference
Manipulating Spacing
====================
- Request: .sp [distance]
Space downwards DISTANCE. With no argument it advances 1 line. A
negative argument causes `gtroff' to move up the page the
specified distance. If the argument is preceded by a `|' then
`gtroff' moves that distance from the top of the page. This
request causes a line break. The default scaling indicator is `v'.
- Request: .ls [nnn]
- Register: \n[.L]
Output NNN-1 blank lines after each line of text. With no
argument, `gtroff' uses the previous value before the last `ls'
call.
.ls 2 \" This causes double-spaced output
.ls 3 \" This causes triple-spaced output
.ls \" Again double spaced
The line spacing is associated with the current environment (*note
Environments::).
The read-only number register `.L' contains the current line
spacing setting.
- Escape: \x'SPACING'
- Register: \n[.a]
Sometimes, extra vertical spacing is only needed occasionally, e.g.
to allow space for a tall construct (like an equation). The `\x'
escape does this. The escape is given a numerical argument,
usually enclosed in quotes (like `\x'3p''); the default scaling
indicator is `v'. If this number is positive extra vertical space
is inserted below the current line. A negative number adds space
above. If this escape is used multiple times on the same line,
the maximum of the values is used.
*Note Escapes::, for details on parameter delimiting characters.
The `.a' read-only number register contains the most recent
(nonnegative) extra vertical line space.
- Request: .ns
- Register: \n[.ns]
Enable "no-space mode". In this mode, spacing (either via `sp' or
via blank lines) is disabled. The `bp' request to advance to the
next page is also disabled, except if it is accompanied by a page
number (see *Note Page Control::, for more information). This
mode ends when actual text is output or the `rs' request is
encountered. The read-only number register `.ns' is set to 1.
This request is useful for macros which want to avoid that
subsequent macros inadvertently insert some vertical space before
the text starts (for example, to set up the first paragraph after
a section header).
- Request: .rs
Disable no-space mode.
File: groff, Node: Tabs and Fields, Next: Character Translations, Prev: Manipulating Spacing, Up: gtroff Reference
Tabs and Fields
===============
A tab character (ASCII char 9, EBCDIC char 5) causes a horizontal
movement to the next tab stop (much like it did on a typewriter).
- Escape: \t
This escape is a non-interpreted tab character. In copy mode
(*note Copy-in Mode::), `\t' is the same as a real tab character.
- Request: .ta [n1 n2 ... nn T r1 r2 ... rn]
- Register: \n[.tabs]
Change tab stop positions. This request takes a series of tab
specifiers as arguments (optionally divided into two groups with
the letter `T') which indicate where each tab stop is to be
(overriding any previous settings).
Tab stops can be specified absolutely, i.e., as the distance from
the left margin. For example, the following sets 6 tab stops every
one inch.
.ta 1i 2i 3i 4i 5i 6i
Tab stops can also be specified using a leading `+' which means
that the specified tab stop is set relative to the previous tab
stop. For example, the following is equivalent to the previous
example.
.ta 1i +1i +1i +1i +1i +1i
`gtroff' supports an extended syntax to specify repeat values after
the `T' mark (these values are always taken as relative) - this is
the usual way to specify tabs set at equal intervals. The
following is, yet again, the same as the previous examples. It
does even more since it defines an infinite number of tab stops
separated by one inch.
.ta T 1i
Now we are ready to interpret the full syntax given at the
beginning: Set tabs at positions N1, N2, ..., NN and then set tabs
at NN+R1, NN+R2, ..., NN+RN and then at NN+RN+R1, NN+RN+R2, ...,
NN+RN+RN, and so on.
Example: `4c +6c T 3c 5c 2c' is equivalent to `4c 10c 13c 18c 20c
23c 28c 30c ...'.
The material in each tab column (i.e., the column between two tab
stops) may be justified to the right or left or centered in the
column. This is specified by appending `R', `L', or `C' to the tab
specifier. The default justification is `L'. Example:
.ta 1i 2iC 2iR
Some notes:
* The default unit of the `ta' request is `m'.
* A tab stop is converted into a non-breakable horizontal
movement which can be neither stretched nor squeezed. For
example,
.ds foo a\tb\tc
.ta T 5i
\*[foo]
creates a single line which is a bit longer than 10 inches (a
string is used to show exactly where the tab characters are).
Now consider the following:
.ds bar a\tb b\tc
.ta T 5i
\*[bar]
`gtroff' first converts the tab stops of the line into
unbreakable horizontal movements, then splits the line after
the second `b' (assuming a sufficiently short line length).
Usually, this isn't what the user wants.
* Superfluous tabs (i.e., tab characters which do not
correspond to a tab stop) are ignored except the first one
which delimits the characters belonging to the last tab stop
for right-justifying or centering. Consider the following
example
.ds Z foo\tbar\tfoo
.ds ZZ foo\tbar\tfoobar
.ds ZZZ foo\tbar\tfoo\tbar
.ta 2i 4iR
\*[Z]
.br
\*[ZZ]
.br
\*[ZZZ]
.br
which produces the following output:
foo bar foo
foo bar foobar
foo bar foobar
The first line right-justifies the second `foo' relative to
the tab stop. The second line right-justifies `foobar'. The
third line finally right-justifies only `foo' because of the
additional tab character which marks the end of the string
belonging to the last defined tab stop.
* Tab stops are associated with the current environment (*note
Environments::).
* Calling `ta' without an argument removes all tab stops.
* The start-up value of `gtroff' is `T 0.5i'. This value is
used even for tty output devices (contrary to UNIX `nroff'
which has tab stops preset every 0.8i).
The read-only number register `.tabs' contains a string
representation of the current tab settings suitable for use as an
argument to the `ta' request.
.ds tab-string \n[.tabs]
\*[tab-string]
=> T120u
- Request: .tc [fill-char]
Normally `gtroff' fills the space to the next tab stop with
whitespace. This can be changed with the `tc' request. With no
argument `gtroff' reverts to using whitespace, which is the
default. The value of this "tab repetition" character is
associated with the current environment (*note Environments::).
* Menu:
* Leaders::
* Fields::
File: groff, Node: Leaders, Next: Fields, Prev: Tabs and Fields, Up: Tabs and Fields
Leaders
-------
Sometimes it may may be desirable to use the `tc' request to fill a
particular tab stop with a given character (for example dots in a table
of contents), but also normal tab stops on the rest of the line. For
this `gtroff' provides an alternate tab mechanism, called "leaders"
which does just that.
A leader character (character code 1) behaves similarly to a tab
character: It moves to the next tab stop. The only difference is that
for this movement, the fill character defaults to a period character and
not to space.
- Escape: \a
This escape is a non-interpreted leader character. In copy mode
(*note Copy-in Mode::), `\a' is the same as a real leader
character.
- Request: .lc [fill-char]
Declare the leader character. Without an argument, leaders act the
same as tabs (i.e., using whitespace for filling). `gtroff''s
start-up value is `.'. The value of this "leader repetition"
character is associated with the current environment (*note
Environments::).
For a table of contents, to name an example, tab stops may be
defined so that the section number is one tab stop, the title is the
second with the remaining space being filled with a line of dots, and
then the page number slightly separated from the dots.
.ds entry 1.1\tFoo\a\t12
.lc .
.ta 1i 5i +.25i
\*[entry]
This produces
1.1 Foo.......................................... 12
File: groff, Node: Fields, Prev: Leaders, Up: Tabs and Fields
Fields
------
"Fields" are a more general way of laying out tabular data. A field
is defined as the data between a pair of "delimiting characters". It
contains substrings which are separated by "padding characters". The
width of a field is the distance on the _input_ line from the position
where the field starts to the next tab stop. A padding character
inserts stretchable space similar to TeX's `\hss' command (thus it can
even be negative) to make the sum of all substring lengths plus the
stretchable space equal to the field width. If more than one padding
character is inserted, the available space is evenly distributed among
them.
- Request: .fc [delim-char [padding-char]]
Define a delimiting and a padding character for fields. If the
latter is missing, the padding character defaults to a space
character. If there is no argument at all, the field mechanism is
disabled (which is the default). Note that contrary to e.g. the
tab repetition character, delimiting and padding characters are
not associated to the current environment (*note Environments::).
Example:
.fc # ^
.ta T 3i
#foo^bar^smurf#
.br
#foo^^bar^smurf#
and here the result:
foo bar smurf
foo bar smurf
File: groff, Node: Character Translations, Next: Troff and Nroff Mode, Prev: Tabs and Fields, Up: gtroff Reference
Character Translations
======================
The control character (`.') and the no-break control character (`'')
can be changed with the `cc' and `c2' requests, respectively.
- Request: .cc [c]
Set the control character to C. With no argument the default
control character `.' is restored. The value of the control
character is associated with the current environment (*note
Environments::).
- Request: .c2 [c]
Set the no-break control character to C. With no argument the
default control character `'' is restored. The value of the
no-break control character is associated with the current
environment (*note Environments::).
- Request: .eo
Disable the escape mechanism completely. After executing this
request, the backslash character `\' no longer starts an escape
sequence.
This request can be very helpful in writing macros since it is not
necessary then to double the escape character. Here an example:
.\" This is a simplified version of the
.\" .BR request from the man macro package
.eo
.de BR
. ds result \&
. while (\n[.$] >= 2) \{\
. as result \fB\$1\fR\$2
. shift 2
. \}
. if \n[.$] .as result \fB\$1
\*[result]
. ft R
..
.ec
- Request: .ec [c]
Set the escape character to C. With no argument the default
escape character `\' is restored. It can be also used to
re-enable the escape mechanism after an `eo' request.
Note that changing the escape character globally will likely break
macro packages since `gtroff' has no mechanism (like TeX) to
`intern' macros, i.e., to convert a macro definition into an
internal form which is independent of its representation. If a
macro is called, it is executed literally.
- Escape: \e
This escape sequence prints the current escape character (which is
the backslash character `\' by default).
A "translation" is a mapping of an input character to an output
character. The default mappings are given in the font definition files
for the specific output device (*note Font Files::); all mappings (both
with `tr' and in the font definition files) occur at output time, i.e.,
the input character gets assigned the metric information of the mapped
output character.
- Request: .tr abcd...
Translate character A to B, character C to D, etc. If there is an
odd number of arguments, the last one is translated to the space
character.
Some notes:
* Special characters (`\(XX', `\[XXX]', `\C'XXX'', `\'', `\`',
`\-', `\_'), characters defined with the `char' request, and
numbered characters (`\N'XXX'') can be translated also.
* The `\e' escape can be translated also.
* Characters can be mapped onto the `\%' and `\~' escapes (but
`\%' and `\~' can't be mapped onto another character).
* The following characters can't be translated: space (with one
exception, see below), backspace, newline, leader (and `\a'),
tab (and `\t').
* Translations are not considered for finding the soft hyphen
character set with the `shc' request.
* The character pair `C\&' (this is an arbitrary character C
followed by the zero width space character) maps this
character to nothing.
.tr a\&
foo bar
=> foo br
It is even possible to map the space character to nothing:
.tr aa \&
foo bar
=> foobar
As shown in the example, the space character can't be the
first character pair as an argument of `tr'. Additionally,
it is not possible to map the space character to any other
character; requests like `.tr aa x' undo `.tr aa \&' instead.
If justification is active, lines are justified in spite of
the `empty' space character (but there is no minimal
distance, i.e. the space character, between words).
* After an output character has been constructed (this happens
at the moment immediately before the character is appended to
an output character list, either by direct output, in a
macro, diversion, or string), it is no longer affected by
`tr'.
* Without an argument, the `tr' request is ignored.
- Request: .trnt abcd...
`trnt' is the same as the `tr' request except that the
translations do not apply to text that is transparently throughput
into a diversion with `\!'. *Note Diversions::, for more
information.
For example,
.tr ab
.di x
\!.tm a
.di
.x
prints `b' to the standard error stream; if `trnt' is used instead
of `tr' it prints `a'.
File: groff, Node: Troff and Nroff Mode, Next: Line Layout, Prev: Character Translations, Up: gtroff Reference
Troff and Nroff Mode
====================
Originally, `nroff' and `troff' were two separate programs, the
former for tty output, the latter for everything else. With GNU
`troff', both programs are merged into one executable, sending its
output to a device driver (`grotty' for tty devices, `grops' for
POSTSCRIPT, etc.) which interprets the intermediate output of `gtroff'.
For UNIX `troff' it makes sense to talk about "Nroff mode" and "Troff
mode" since the differences are hardcoded. For GNU `troff', this
distinction is not appropriate because `gtroff' simply takes the
information given in the font files for a particular device without
handling requests specially if a tty output device is used.
Usually, a macro package can be used with all output devices.
Nevertheless, it is sometimes necessary to make a distinction between
tty and non-tty devices: `gtroff' provides two built-in conditions `n'
and `t' for the `if', `ie', and `while' requests to decide whether
`gtroff' shall behave like `nroff' or like `troff'.
- Request: .troff
Make the `t' built-in condition true (and the `n' built-in
condition false) for `if', `ie', and `while' conditional requests.
This is the default if `gtroff' (_not_ `groff') is started with
the `-R' switch to avoid loading of the start-up files `troffrc'
and `troffrc-end'. Without `-R', `gtroff' stays in troff mode if
the output device is not a tty (e.g. `ps').
- Request: .nroff
Make the `n' built-in condition true (and the `t' built-in
condition false) for `if', `ie', and `while' conditional requests.
This is the default if `gtroff' uses a tty output device; the
code for switching to nroff mode is in the file `tty.tmac' which
is loaded by the start-up file `troffrc'.
*Note Conditionals and Loops::, for more details on built-in
conditions.
For tty output devices, underlining is done by emitting sequences of
`_' and `\b' (the backspace character) before the actual character.
Literally, this is printing an underline character, then moving back
one character position, and printing the actual character at the same
position as the underline character (similar to a typewriter).
Usually, a modern terminal can't interpret this (and the original
Teletype machines for which this sequence was appropriate are no longer
in use). You need a pager program like `less' which translates this
into ISO 6429 SGR sequences to control terminals.
File: groff, Node: Line Layout, Next: Page Layout, Prev: Troff and Nroff Mode, Up: gtroff Reference
Line Layout
===========
The following drawing shows the dimensions which `gtroff' uses for
placing a line of output onto the page. They are labeled with the
request which manipulates each dimension.
-->| in |<--
|<-----------ll------------>|
+----+----+----------------------+----+
| : : : |
+----+----+----------------------+----+
-->| po |<--
|<--------paper width---------------->|
These dimensions are:
`po'
"Page offset" - this is the leftmost position of text on the final
output, defining the "left margin".
`in'
"Indentation" - this is the distance from the left margin where
text is printed.
`ll'
"Line length" - this is the distance from the left margin to right
margin.
.in +.5i
.ll -.5i
A bunch of really boring text which should
be indented from both margins.
Replace me with a better (and more) example!
.in -.5i
.ll +.5i
- Request: .po [offset]
- Request: .po +offset
- Request: .po -offset
- Register: \n[.o]
Set horizontal page offset to OFFSET (or increment or decrement
the current value by OFFSET). Note that this request does not
cause a break, so changing the page offset in the middle of text
being filled may not yield the expected result. The initial value
is 1i. For tty output devices, it is set to 0 in the startup file
`troffrc'; the default scaling indicator is `m' (and not `v' as
incorrectly documented in the original UNIX troff manual).
The current page offset can be found in the read-only number
register `.o'.
If `po' is called without an argument, the page offset is reset to
the previous value before the last call to `po'.
.po 3i
\n[.o]
=> 720
.po -1i
\n[.o]
=> 480
.po
\n[.o]
=> 720
- Request: .in [indent]
- Request: .in +indent
- Request: .in -indent
- Register: \n[.i]
Set indentation to INDENT (or increment or decrement the current
value by INDENT). This request causes a break. Initially, there
is no indentation.
If `in' is called without an argument, the indentation is reset to
the previous value before the last call to `in'. The default
scaling indicator is `m'.
The indentation is associated with the current environment.
If a negative indentation value is specified (which is not
allowed), `gtroff' emits a warning of type `range' and sets the
indentation to zero.
The effect of `in' is delayed until a partially collected line (if
it exists) is output. A temporary indent value is reset to zero
also.
The current indentation (as set by `in') can be found in the
read-only number register `.i'.
- Request: .ti offset
- Request: .ti +offset
- Request: .ti -offset
- Register: \n[.in]
Temporarily indent the next output line by OFFSET. If an
increment or decrement value is specified, adjust the temporary
indentation relative to the value set by the `in' request.
This request causes a break; its value is associated with the
current environment. The default scaling indicator is `m'. A call
of `ti' without an argument is ignored.
If the total indentation value is negative (which is not allowed),
`gtroff' emits a warning of type `range' and sets the temporary
indentation to zero. `Total indentation' is either OFFSET if
specified as an absolute value, or the temporary plus normal
indentation, if OFFSET is given as a relative value.
The effect of `ti' is delayed until a partially collected line (if
it exists) is output.
The read-only number register `.in' is the indentation that applies
to the current output line.
The difference between `.i' and `.in' is that the latter takes
into account whether a partially collected line still uses the old
indentation value or a temporary indentation value is active.
- Request: .ll [length]
- Request: .ll +length
- Request: .ll -length
- Register: \n[.l]
- Register: \n[.ll]
Set the line length to LENGTH (or increment or decrement the
current value by LENGTH). Initially, the line length is set to
6.5i. The effect of `ll' is delayed until a partially collected
line (if it exists) is output. The default scaling indicator
is `m'.
If `ll' is called without an argument, the line length is reset to
the previous value before the last call to `ll'. If a negative
line length is specified (which is not allowed), `gtroff' emits a
warning of type `range' and sets the line length to zero.
The line length is associated with the current environment.
The current line length (as set by `ll') can be found in the
read-only number register `.l'. The read-only number register
`.ll' is the line length that applies to the current output line.
Similar to `.i' and `.in', the difference between `.l' and `.ll'
is that the latter takes into account whether a partially
collected line still uses the old line length value.